﻿
var _domain="www.superwf.com";
var _spliter="!#!";
var _first=1;

$(document).ready(function(){
if(typeof(initAccount)!=typeof(undefinde))
    initAccount();
    });

function   GetCookie()   
{   
  var   aCookie   =   document.cookie.split(";");   
  for   (var   i=0;   i   <   aCookie.length;   i++)   
  {   
      var   aCrumb   =   aCookie[i].split("=");   
      alert(aCrumb[0]   +   "   =   "   +   aCrumb[1]);   
  }   
}   
function rewrite()
{
    
        var val = $("#loginname").val().trim()+_spliter+ "null"+_spliter+'ZH_TW';//_lang;
        setCookies(_domain,val);
        return true;
}

function setCookies(name,value)
{
   var Days = 60;
   var exp   = new Date();
   exp.setTime(exp.getTime() + Days*24*60*60*1000);
   document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
}

function getCookies(name)
{
   var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
   if(arr != null) return unescape(arr[2]); return null;
}

function delCookies(name)
{
   var exp = new Date();
   exp.setTime(exp.getTime() - 1);
   var cval=getCookie(name);
   if(cval!=null) document.cookie=name +"="+cval+";expires="+ exp.toGMTString();
}

function initAccount()
{
        start();
}


function start()
{
    var austr = getCookies(_domain);
    if(austr==null)
        return;
    var fm = window.document.form1;
    //_lang = austr.split(_spliter)[2];
    //setDefault(fm.sellan,_lang);
    //$("#loginname").autocomplete="on";
    $("#loginname").val(austr.split(_spliter)[0]);
    $("#loginpwd").focus();
}


function setDefault(obj,value)
{
    for(var i=0;i<obj.options.length;i++)
    {
        if(obj.options[i].value==value)
        {
            obj.options[i].selected=true;
            return;
        }
    }
}